<template>
  <div class="userOverview">
    <div class="title">用户总览</div>
    <div class="content">
      <div class="content_wrapper">
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/用户总数量.png" alt="">
            </div>
            <div class="right">
              <div>
                用户总数量
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{info.allUserCount || 0}}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/普通用户.png" alt="">
            </div>
            <div class="right">
              <div>
                普通用户
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.ordinaryUserCount || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/会员用户.png" alt="">
            </div>
            <div class="right">
              <div>
                会员用户
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.vipUserCount || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/会员占比.png" alt="">
            </div>
            <div class="right">
              <div>
                会员占比
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.percent + '%' || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/代理商.png" alt="">
            </div>
            <div class="right">
              <div>
                代理商
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.agentCount || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/广告.png" alt="">
            </div>
            <div class="right">
              <div>
                广告
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.bannerCount || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/车队数量.png" alt="">
            </div>
            <div class="right">
              <div>
                车队数量
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.fleetCount || 0 }}</div>
            </div>
          </div>
        </div>
        <div class="content_item" style="border-right:none">
          <div class="content_inner">
            <div class="left">
              <img src="@/assets/operation/车队用户.png" alt="">
            </div>
            <div class="right">
              <div>
                车队用户
                <span style="color:#8D9EAE">(个)</span>
              </div>
              <div class="count">{{ info.fleetUserCount || 0 }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getUserStat } from "@/api/common";
export default {
  data(){
    return {
      info:{
        percent:0
      }
    }
  },
  mounted(){
    this.getInfo()
  },
  methods:{
    getInfo(){
      getUserStat().then(res=>{
        if(res.code == 200){
          this.info = res.data
          const { vipUserCount,allUserCount } = this.info
          this.info.percent = vipUserCount && allUserCount ? vipUserCount / this.info.allUserCount * 100 : 0
        }
      })
    }
  }
};
</script>

<style lang="scss" scoped>
@import '../../../utils/common.scss';
.userOverview{
  border-bottom: 1px solid #E8E8E8;
  padding-bottom:24px;
  .content{
    padding: 24px 20px;
    border-radius: 10px;
    background-color: #fff;
    .content_wrapper{
      display: flex;
      .content_item{
        flex: 1;
        display: flex;
        align-items: center;
        height: 100px;
        border-right:1px solid #E9EFF3;
        .content_inner{
          height: 57px;
          display: flex;
          img{
            width: 40px;
            height: 40px;
          }
          .left{
            margin-left: 20px;
          }
          .right{
            margin-left:10px;
            font-size: 12px;
            .count{
              font-size: 24px;
              font-weight: bold;
              margin-top: 8px;
            }
          }
        }
      }
    }
  }
}
</style>